#include <stdio.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>

int main()
{
    pid_t id = fork();
    if(id == 0)
    {
        char* const myEnv[] = {
            "MYVAL1 = 123",
            "MYVAL2 = 456",
            "MYVAL3 = 789",
            NULL
        };
        execle("./myexe","./myexe",NULL,myEnv);
        exit(1);
    }
    else if(id>0)
    {
        int ret = wait(NULL);
        if(ret>0)
        {
            printf("wait success\n");
        }
        else
        {
            perror("wait failed\n");
        }
    }
    else 
    {
        perror("fork failed");
        exit(1);
    }

    return 0;
}

